package ssm.service.impl;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import ssm.dao.IUserDao;
import ssm.pojo.User;
import ssm.service.IUserService;

import javax.annotation.Resource;
import java.util.List;

/**
 * Author: silence
 * Date: 17-5-26.
 */
@Service("userService")
public class UserServiceImpl implements IUserService {

    @Resource
    private IUserDao userDao;

    @Override
    public User getUserById(int userId) {
        return userDao.selectByPrimaryKey(userId);
    }

    @Override
    public List<User> findAllByQuery() {
        return userDao.findAllByQuery();
    }

    @Override
    public String insert(User record) {


        if (userDao.insert(record) > 0)
            return "添加成功";
        return "添加失败";
    }

    @Override
    public void addUser(User user) {

    }

    @Override
    public User findUserByUsername(String username) {
        return null;
    }

    @Override
    public int updateByPrimaryKey(User record) {
        return userDao.updateByPrimaryKey(record);
    }

    @Override
    public void deleteByPrimaryKey(Integer id) {

        userDao.deleteByPrimaryKey(id);

    }

    @Override
    public List<User> selectPageList(Integer startpage, Integer sizelist) {
        return userDao.selectPageList(startpage, sizelist);
    }

    @Override
    public Integer count() {
        return userDao.count();
    }

}



